<?php

/**
 * Passenger form base class.
 *
 * @package    form
 * @subpackage passenger
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BasePassengerForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'          => new sfWidgetFormInputHidden(),
      'px_number'   => new sfWidgetFormInput(),
      'sex'         => new sfWidgetFormChoice(array('choices' => array('Male' => 'Male', 'Female' => 'Female'))),
      'age_to_date' => new sfWidgetFormInput(),
      'birth_date'  => new sfWidgetFormDate(),
      'birth_place' => new sfWidgetFormInput(),
      'person_id'   => new sfWidgetFormDoctrineChoice(array('model' => 'Person', 'add_empty' => false)),
      'created_at'  => new sfWidgetFormDateTime(),
      'updated_at'  => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'          => new sfValidatorDoctrineChoice(array('model' => 'Passenger', 'column' => 'id', 'required' => false)),
      'px_number'   => new sfValidatorString(array('max_length' => 255)),
      'sex'         => new sfValidatorChoice(array('choices' => array('Male' => 'Male', 'Female' => 'Female'), 'required' => false)),
      'age_to_date' => new sfValidatorInteger(),
      'birth_date'  => new sfValidatorDate(),
      'birth_place' => new sfValidatorString(array('max_length' => 255)),
      'person_id'   => new sfValidatorDoctrineChoice(array('model' => 'Person')),
      'created_at'  => new sfValidatorDateTime(array('required' => false)),
      'updated_at'  => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('passenger[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Passenger';
  }

}
